package com.hp.process;

import java.util.concurrent.ConcurrentHashMap;

public class Server {

    /**
     * 存放连接设备
     */
   public static  ConcurrentHashMap<String,KeepAlive> datalist=new ConcurrentHashMap<>();




    public static int port;
    public static volatile boolean running=false;

    public static Thread connWatchDog;
      
    public Server(int port) {  
        this.port = port;
        start();
    }  
  
    public void start(){  
        if(running)return;  
        running=true;  
        connWatchDog = new Thread(new ConnWatchDog());  
        connWatchDog.start();  
    }  
      
    public static void stop(){
        if(running)running=false;  
        if(connWatchDog!=null)connWatchDog.stop();  
    }

    public  ConcurrentHashMap<String, KeepAlive> getDatalist() {
        return datalist;
    }
}
